#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2020/6/19 15:32
# @Author  : jackkli
# @Site    : 
# @File    : qci_100w.py
# @Software: PyCharm
import json
import requests

"""
腾讯会议压测 -- PCU 100w
http://qci.oa.com/#/pro/935/pipeline/49982/totalresult/current
"""


def start_qci_task():
    # http://api.dq.oa.com/qci/rest-api/pipeline/{pipeline_id}/start
    # http://api.dq.oa.com/qci/rest-api
    url = 'http://api.dq.oa.com/qci/rest-api/pipeline/49982/start'
    headers = {
        'Content-Type': 'application/json',
        'X-DQAPI-Authentication': 'XZ3UCU6OY90E2320S7LLFZUBPX8QAA7E',
        'X-DQAPI-USERNAME': 'jackkli'
    }
    data = {
        "cur_env_params": {
            "CGI_NODE_COUNT": {
                "value": "10",
                "desc": "CGI 节点数目"
            },
            "XMPP_NODE_COUNT": {
                "value": "60",
                "desc": "XMP 节点数目"
            },
            "REST_NODE_COUNT": {
                "value": "30",
                "desc": "REST API 节点数目"
            },
            "PCU": 100
        },
        "cur_branch": "qci_robot",
        "cur_tag": "",
        "cur_revision": "",
        "trigger_base": "branch"
    }
    data1 = {
        "cur_env_params": {},
        "cur_branch": "qci_robot",
        "cur_tag": "",
        "cur_revision": "",
        "trigger_base": "branch"
    }

    params = json.dumps(data)
    res = requests.post(url=url, data=params, headers=headers)
    print(res)
    print(res.text)
    resp_text = json.loads(res.text)
    return resp_text


if __name__ == '__main__':
    start_qci_task()
